<?php if (!defined('MAX_ON')){echo "<h1>ACCESS DENIED</h1>You cannot access this file directly.";exit();} ?>
<?php if ($template_hook=='start'){ ?>
<?php }elseif ($template_hook=='1'){ ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" dir="<?php echo $lang['header_dir']; ?>">
	<head>
		<!-- show site name and location -->
		<meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />
		<title><?php echo "$site_name"; ?> | <?php echo "$location_name"; ?></title>
		<meta name="description" content="<?php echo "$location_text"; ?>" />
		<meta name="keywords" content="<?php echo "$site_name, $site_desc, $location_name"; ?>" />
		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
		<link rel="shortcut icon" href="<?php echo "$max_domain"; ?>/favicon.ico" />
<?php if (isset($_GET['forum']) && $show_rss=='1'){ ?>
		<!-- show rss for forum -->
		<link href="<?php echo "$max_domain"; ?>/rss.php?forum=<?php echo "$forum"; ?>" rel="alternate" type="application/rss+xml" title="<?php echo $lang['header_rss_forum']; ?>" />
<?php } ?>
		<!-- show stylesheet -->
		<style type="text/css" id="maxforum_css">
			<?php echo $header_temp; ?>
		</style>
		<style type="text/css">
			select, option {
				behavior: url(<?php echo "$max_domain"; ?>/libs/max_select.htc);
			}
		</style>							
		<script type="text/javascript">
			var clear="<?php echo "$max_domain"; ?>/libs/js/clear.gif" 
		</script>
	
		<!--[if lt IE 7]><script type="text/javascript" src="<?php echo "$max_domain"; ?>/libs/js/unitpngfix.js"></script><![endif]-->
		<script type="text/javascript" src="<?php echo "$max_domain"; ?>/libs/js/jquery-1.4.4.min.js"></script>
		<script type="text/javascript" src="<?php echo "$max_domain"; ?>/libs/js/max_js.js"></script>
		<script type="text/javascript" src="<?php echo "$max_domain"; ?>/libs/js/prototype.js"></script>

		<script type="text/javascript">
			/* Editor Lang */
			var TitleText_Texarea ="<?php echo $lang['newpost_title_bbcode']; ?>";
			var TitleText ="<?php echo $lang['newpost_title_wysiwyg']; ?>";
			
			function SmiliesPopUp(URL) {
			day = new Date();
			id = day.getTime();
			eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=300,height=400');");
			}
			function WarnPopUp(URL) {
			day = new Date();
			id = day.getTime();
			eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=400');");
			}
			function confirmation() {
			var answer = confirm("<?php echo $lang['messages_alert']; ?>")
				if (answer){
					window.location = "<?php echo max_link("index.php?page=messages&act=inbox", "messages"); ?>";
					<?php echo mysql_query("UPDATE {$db_prefix}members SET newmsg='0' WHERE ID='$my_id'"); ?>
				}
			}
		</script>

<?php }elseif ($template_hook=='before_body'){ ?>	
	</head>						
	<body <?php echo $alertmsg; ?>>
<?php }elseif ($template_hook=='after_body'){ ?>				
<?php if (!isset($max_name) && $register_bar=='1' && $guest_register=='1' && $_GET['page'] !='register'){ ?>
		<div id="explorerbar"><a href="<?php echo max_link("index.php?page=register", "register"); ?>"><?php echo $lang['header_guest']; ?></a></div>
<?php } ?>
		<div class="site-width">
			<!-- show the site name and description in the header -->
			<div class="header">
				<div class="header-left">
					<a href="<?php echo "$max_domain"; ?>"><img  src="<?php echo "$header_left_img"; ?>" alt="" /></a>
				</div>
			</div>
<?php }elseif ($template_hook=='3'){ ?>
<?php if ($fb_id != "" OR $fb_secr != ""){ ?>
    <div id="fb-root"></div>
    <script src="http://connect.facebook.net/en_US/all.js"></script>
    <script>
	FB.init({appId: '<?php echo $fb_id; ?>', status: true, cookie: true, xfbml: true});
	FB.Event.subscribe('auth.login', function(response) {
<?php if (!$_COOKIE['max_name']){ ?>
        window.location = "<?php echo max_link("index.php?page=register", "register"); ?>";
<?php } ?>
	});
	FB.Event.subscribe('auth.logout', function(response) {
		window.location = "<?php echo max_link("index.php?page=logout", "logout"); ?>";
	});
    </script>
<?php } ?>
<?php }elseif ($template_hook=='end'){ ?>
<?php } ?>
